<template>
    <div>
        <p v-html="html"></p>
    </div>
</template>
<style>
</style>
<script>
import request from "@/utils/request";
import axios from 'axios'
export default {
  // 使用时请使用 :url.sync=""传值
  props: {
    url: {
      required: true
    }
  },
  data() {
    return {
      loading: false,
      html: ""
    };
  },
  watch: {
  url(val){
    if(val){
     this.load(val);
    }
  }
  },
  mounted() {
   
  },
  methods: {
    load(url) {
      if (url) {
        // 加载中
        let param = {
          accept: "text/html, text/plain"
        };
        axios.get(url).then(res=>{
          if(res&&res.data){
            this.html=res.data;
          }
        })
        // request(url, param).then(res => {
           
        // });
      }
    }
  }
};
</script>